package com.example.projectsharedspace;

import java.util.Calendar;



public class Message {
	
	private final static int VIEW_TYPE = 0;
	
	private int id;
	private String msg;
	private String shortMsg;
	private Calendar timedate;
	private User user;
	
	
	public Message(String msg, Calendar td, User u) {
		//id = u.getHome().getMsgCount();
		//u.getHome().updateMsgCount();
		this.msg = msg;
		timedate = td;
		user = u;
		
		if(msg.length() > 60) {
			shortMsg = msg.substring(0, 40) + "...";
		} else {
			shortMsg = msg;
		}
	}
	
	public String getMsg() {
		return msg;
	}
	
	public String getShortMsg() {
		return shortMsg;
	}
	
	public Calendar getTD() {
		return timedate;
	}
	
	public User getUser() {
		return user;
	}
	
	public void setMsg(String msg) {
		this.msg = msg;
	}
	
	public void setShortMsg(String shortMsg) {
		this.shortMsg = shortMsg;
	}
	
	public void setTD() {
		this.timedate = Calendar.getInstance();
	}
	
	public void setUser(User u) {
		this.user = u;
	}
	
	public int getViewType() {
		return VIEW_TYPE;
	}
	
	public int getId() {
		return id;
	}
	
}
